package com.xinlong.shop.core.temp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinlong.shop.core.temp.entity.VipMember;
import com.xinlong.shop.core.temp.mapper.VipMemberMapper;
import com.xinlong.shop.core.temp.service.IVipMemberService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 临时老系统使用-vip会员id 服务实现类
 * </p>
 *
 * @author Sylow
 * @since 2023-04-07
 */
@Service
public class VipMemberServiceImpl extends ServiceImpl<VipMemberMapper, VipMember> implements IVipMemberService {

    @Override
    public void update(VipMember vipMember, Integer id) {
        UpdateWrapper<VipMember> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id);
        this.update(vipMember, updateWrapper);
    }
    @Override
    public void delete(Integer id) {
        UpdateWrapper<VipMember> deleteWrapper = new UpdateWrapper<>();
        deleteWrapper.eq("id", id);
        this.remove(deleteWrapper);
    }

    @Override
    public VipMember find(Integer memberId) {
        QueryWrapper<VipMember> query = new QueryWrapper<>();
        query.eq("member_id", memberId);
        return this.getOne(query);
    }

}
